package com.ljc.cjgl.entitiy;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.springframework.data.annotation.CreatedBy;
@Entity
public class ScoringGrade {
	private Integer id;
	private Scoring scoring;
	private Tea teacher;
	private Stu student;
	private Integer grade;
	
	public ScoringGrade() {
		super();
	}

	public ScoringGrade(Integer id) {
		super();
		this.id = id;
	}
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne
	@CreatedBy
	public Scoring getScoring() {
		return scoring;
	}

	public void setScoring(Scoring scoring) {
		this.scoring = scoring;
	}

	@ManyToOne
	@CreatedBy
	public Tea getTeacher() {
		return teacher;
	}

	public void setTeacher(Tea teacher) {
		this.teacher = teacher;
	}
	
	@ManyToOne
	@CreatedBy
	public Stu getStudent() {
		return student;
	}

	public void setStudent(Stu student) {
		this.student = student;
	}

	public Integer getGrade() {
		return grade;
	}

	public void setGrade(Integer grade) {
		this.grade = grade;
	}
	
	@Transient
	public String getScoringTitle() {
		return scoring==null?null:scoring.getTitle();
	}
	
	@Transient
	public String getScoringExplanation() {
		return scoring==null?null:scoring.getExplanation();
	}
	
	@Transient
	public Integer getScoringScore() {
		return scoring==null?null:scoring.getScore();
	}
	
	@Transient
	public String getTestName() {
		return scoring==null||scoring.getTest()==null?null:scoring.getTest().getName();
	}
	
	@Transient
	public String getTeacherName() {
		return teacher==null?null:teacher.getName();
	}
	
	@Transient
	public String getStudentName() {
		return student==null?null:student.getName();
	}
}
